package sql

import java.util.Properties

import org.apache.spark.sql.SparkSession

object BSSSQL {

  def main(args: Array[String]): Unit = {


    val spark = SparkSession.builder().appName("BSS-data").master("local[4]").getOrCreate()

    val custs = spark.read.format("jdbc").options(
      Map("driver" -> "oracle.jdbc.driver.OracleDriver",
        "url" -> "jdbc:oracle:thin:@192.168.8.128:1521:orcl1",
        "dbtable" -> "GTBSS.CUST",
        "user" -> "gtbss",
        "password" -> "ctsig2018")).load()
    custs.createTempView("cust")

    val properties = new Properties()
    properties.put("user","root")
    properties.put("password","123456")

    custs.printSchema()
    custs.show(10)
    //custs.write.mode("ignore").jdbc("jdbc:mysql://127.0.0.1:3306/gtbss","customer",properties)

    spark.close()

  }
}
